extends ../layout.pug

block title
  title 牌局记录

block stylesheets
  link(rel="stylesheet", href="/css/match-records.css")

block body

  if matches && matches.months && matches.months.length
    each month in matches.months
      div.match__month
        div.match__title #{month == (new Date()).getMonth() + 1 ? '本' : month }月
        each match in matches[month]
          div.match__list
            a.match__item(href=`/wechat/personalHome/match-detail?matchId=${match.matchId}&id=${user.id}`)
              div.item__date
                div.date__dayOfWeek #{match.date.label}
                div.date__time #{match.date.time}
              div(class= match.type === 'xzdd' ? 'item__icon--xzdd' : 'item__icon--xlch')
              div.item__detail
                  div.item__score #{match.score >= 0 ? '+' + match.score : match.score }分
                  div.item__players #{match.players.map(player => player.name).join(' ')}
              div.item__icon--next
  else
    .match-records.match-records--none
      img(src="/images/def_img@2x.png", alt="暂时相关记录")
      p.tip 暂无相关记录

  script.
    (function() {
      var elItems = Array.prototype.slice(document.getElementsByClassName('match__item'))
    }())

